package com.service.pay.diamond.listener;

import com.service.pay.diamond.event.PayOrderEvent;
import com.service.pay.diamond.model.OrderModel;
import com.service.pay.diamond.service.ConsumeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

@Component
@Slf4j
/*消费订单事件*/
public class PayOrderEventListener {
    @Autowired
    private ConsumeService consumeService;

    @EventListener
    public void payOrder(PayOrderEvent event) {
        OrderModel orderModel = event.getOrderModel();
        log.warn("支付订单事件：{}", orderModel);
        consumeService.consume(orderModel);
    }
}
